/**
 * @author SilverBiology, LLC
 * @website http://code.google.com/p/gbif-spreadsheet-processor/
*/
Ext.namespace('GBIF');
Ext.namespace('GBIF.GeoSpatial')

GBIF.GeoSpatial.TabManager = function(config){
	
	var tabs = [];
	
	config.tabConfig = config.tabConfig || {};

	Ext.applyIf( config.tabConfig,{
			consoleShow: true
		,	georssShow: true
		,	legendShow: true
		,	featuredatagrid : true
 }); 
	
	if (config.tabConfig.consoleShow) {
		var consolepanel = new GBIF.GeoSpatial.Console();
		tabs.push(consolepanel);
	}
	
	if (config.tabConfig.georssShow) {
		var georsskmldatapanel = new GBIF.GeoSpatial.GeoRssKmlDataPanel(); 		
		tabs.push(georsskmldatapanel);
	}
	 
	if (config.tabConfig.legendShow) {
		var legendpanel = new GBIF.GeoSpatial.LegendPanel();
		tabs.push(legendpanel);
	}
	
	if (config.tabConfig.featuredatagrid) {
		this.featuredatagrid = new GBIF.GeoSpatial.FeatureDataGrid()
		tabs.push(this.featuredatagrid);
	}
	
	GBIF.GeoSpatial.BUS.on('addTab',function(datagrid){
		this.add(datagrid);
	}, this);
	
	Ext.apply(this, config, {
			border: false
		,	activeItem: 0
		,	activeTab: 0
		,	width: '100%'
		,	height: 200
		,	enableTabScroll: true
		,	defaults: { 
					autoScroll: true
				,	border: false 
			}
		,	items: [ tabs ]
	});

	GBIF.GeoSpatial.TabManager.superclass.constructor.apply(this, arguments);
}	

Ext.extend(GBIF.GeoSpatial.TabManager, Ext.TabPanel, {});